package com.ouc.pampas;

import com.google.common.base.Strings;
import java.io.Serializable;

public class App implements Serializable {
	public static final String FRONT_CONFIG_FILE = "front_config.yaml";
	public static final String BACK_CONFIG_FILE = "back_config.yaml";
	private static final long serialVersionUID = 6605245210822077562L;
	private String key;
	private String domain;
	private String proxyRoot;
	private String assetsHome;
	private String configJsFile;
	private String configPath;
	private String desc;

	public String toString() {
		return "App(key=" + getKey() + ", domain=" + getDomain() + ", proxyRoot=" + getProxyRoot() + ", assetsHome="
				+ getAssetsHome() + ", configJsFile=" + getConfigJsFile() + ", configPath=" + getConfigPath()
				+ ", desc=" + getDesc() + ")";
	}

	public String getKey() {
		return this.key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getDomain() {
		return this.domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public void setProxyRoot(String proxyRoot) {
		this.proxyRoot = proxyRoot;
	}

	public String getAssetsHome() {
		return this.assetsHome;
	}

	public void setAssetsHome(String assetsHome) {
		this.assetsHome = assetsHome;
	}

	public void setConfigJsFile(String configJsFile) {
		this.configJsFile = configJsFile;
	}

	public String getConfigPath() {
		return this.configPath;
	}

	public void setConfigPath(String configPath) {
		this.configPath = configPath;
	}

	public String getDesc() {
		return this.desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getProxyRoot() {
		return Strings.isNullOrEmpty(this.proxyRoot) ? "http://" + this.domain + "/" : this.proxyRoot;
	}

	public String getConfigJsFile() {
		return Strings.isNullOrEmpty(this.configJsFile) ? "assets/scripts/config.js" : this.configJsFile;
	}

	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof App)) {
			return false;
		}
		App app = (App) o;
		if (!this.key.equals(app.key)) {
			return false;
		}
		return true;
	}

	public int hashCode() {
		return this.key.hashCode();
	}
}
